from dotenv import load_dotenv, find_dotenv
from langchain_openai import ChatOpenAI
from langchain.schema import (
    AIMessage, # 等价于OpenAI接口中的assistant role
    HumanMessage, # 等价于OpenAI接口中的user role
    SystemMessage # 等价于OpenAI接口中的system role
)

_ = load_dotenv(find_dotenv())

llm = ChatOpenAI(model="gpt-4o")

messages = [
    SystemMessage(content="你是AGIClass的课程助理。"),
    HumanMessage(content="我是学员，我叫王卓然。"),
    AIMessage(content="欢迎！"),
    HumanMessage(content="我是谁")
]

response = llm.invoke(messages)
print(response.content)